export interface ResponseData {
  code: number
  message: string
  ok: boolean
}

// SPU数据的ts类型
export interface SpuData {
  id?: number
  createTime?: string
  updateTime?: string
  spuName: string
  description: string
  category3Id: number | string
  tmId: number | string
  spuSaleAttrList: null | SaleAttr[]
  spuImageList: null | SpuImage[]
  spuPosterList?: null
}

// 数据:元素都是已有SPU数据类型
export type Records = SpuData[]

// 定义获取已有的SPU接口返回的数据ts类型
export interface HasSpuResponseData extends ResponseData {
  data: {
    records: Records
    total: number
    size: number
    current: number
    searchCount: boolean
    pages: number
  }
}

//品牌数据TS类型
export interface TradeMark {
  id: number
  tmName: string
  logoUrl: string
  createTime?: string
  updateTime?: string
}

// 品牌接口返回的数据ts类型
export interface AllTradeMark extends ResponseData {
  data: TradeMark[]
}

// 商品图片ts类型
export interface SpuImage {
  id?: number
  createTime?: string
  updateTime?: string
  spuId?: number
  imgName?: string
  imgUrl?: string
  name?: string
  url?: string
}

// 已有的SPU的照片墙ts类型
export interface SpuHasImage extends ResponseData {
  data: SpuImage[]
}

// 已有的SPU的销售属性ts类型
export interface SaleAttrValue {
  id?: number
  createTime?: string
  updateTime?: string
  spuId?: number
  baseSaleAttrId: number | string
  saleAttrName?: string
  saleAttrValueName: string
  isChecked?: null
}

// 存储已有的销售属性值的数组类型
export type SpuSaleAttrValueList = SaleAttrValue[]

// 销售属性对象ts类型
export interface SaleAttr {
  id?: number
  createTime?: string
  updateTime?: string
  spuId?: number
  baseSaleAttrId: number | string
  saleAttrName: string
  spuSaleAttrValueList: SpuSaleAttrValueList
  flag?: boolean
  tempSaleAttrValue?: string
  saleIdAndValueId?: string
}

export interface SaleAttrResponseData extends ResponseData {
  data: SaleAttr[]
}

// 已有的全部SPU的返回数据ts类型
export interface HasSaleAttr {
  id: number
  name: string
}

export interface HasSaleAttrResponseData extends ResponseData {
  data: HasSaleAttr[]
}

export interface SkuData {
  category3Id: number | string
  spuId: number | string
  tmId: number | string
  skuName: string
  price: number | string
  weight: number | string
  skuDesc: string
  skuAttrValueList?: SkuAttrValue[]
  skuSaleAttrValueList?: [
    {
      saleAttrId: number | string
      saleAttrValueId: number | string
    },
  ]
  skuDefaultImg: string
}

export interface SkuAttrValue {
  attrId: number | string
  valueId: number | string
}
// 获取SKU的接口返回数据
export interface SkuInfoData extends ResponseData {
  data: SkuData[]
}
